﻿component  output="false"
{

	public it.millemultimedia.easyBlog.model.AbsBean[] function createList( required String listStr, required String propertyName ){
	
		var obj = createInstance();
		var list = createObject( 'java','java.util.ArrayList' ).init();
		var arr = listToArray( arguments.listStr );
		var i = 0;
		
		for( i=1; i<=arrayLen( arr ); i++ ){
		
			obj = createInstance();
			
			evaluate( "obj.set#arguments.propertyName#( arr[ i ] )" );
		
			list.add( obj );
		
		}
		
		return list;
	
	}
	
	private Struct function getPaging( required Numeric recordCount, required Numeric startRow, required Numeric maxRow ){
		
		var result ={};
		
		result.StartRow=Min((arguments.startRow-1)*arguments.maxRow+1,Max(arguments.recordcount,1));
		result.EndRow=Min(StartRow+arguments.maxRow-1,arguments.recordcount);
		result.TotalPages=Ceiling(arguments.recordcount/arguments.maxRow);
	
		return result;
	}

}